<%@ page contentType="text/html; charset=UTF-8" language="java" import="base.tools.Constants,java.util.*" errorPage="" %>
<%@ include file="../../common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>用户管理</title>
<link href="<%=Constants.PREFIX_PATH%>/css/admin.css" rel="stylesheet" type="text/css" />
<script src="<%=Constants.PREFIX_PATH %>/js/jquery.js" type="text/javascript"></script>
<script src="<%=Constants.PREFIX_PATH %>/js/pony.js" type="text/javascript"></script>
<script type="text/javascript">
function getTableForm() {
	return document.getElementById('tableForm');
}
function optDelete() {
	if(Pn.checkedCount('ids')<=0) {
		alert("请选择您要操作的数据");
		return;
	}
	if(!confirm("您确定删除吗？")) {
		return;
	}
	var f = getTableForm();
	f.action="UsersAction.do";
	f.submit();
}
</script>
</head>
<body bgcolor="#FFFFFF">
<div class="body-box">
	<div class="rpos">当前位置: 角色管理 - 列表</div>
	<form class="ropt">
	<logic:equal name="user" property="IS_SUPER" value="1">
	<input type="button" value="添加" onclick="location='<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=user_add';"/>
	</logic:equal>
	<logic:equal name="user" property="IS_SUPER" value="0">
			<logic:equal name="user" property="ROLE_ID" value="2">
			<input type="button" value="添加" onclick="location='<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=user_add';"/>
			</logic:equal>		
	</logic:equal>	
	</form>
	<div class="clear"></div>
</div>
<form id="tableForm" method="post" >
<input type="hidden" name="opt" value="user_group_delete"/>
<table style="" width="100%" cellspacing="1" cellpadding="0" border="0">
	<tr class="left_topbg">
		<th width="10" class="td_title_right_oth"><input type='checkbox' onclick='Pn.checkbox("ids",this.checked)'/></th>
		<th width="80" class="thborder">ID</th>
		<th width="140" class="thborder">角色名</th>
		<th width="100" class="thborder">是否锁定</th>
		<th width="180" class="thborder">操作选项</th></tr>
	<logic:iterate id="list" name="roleList">
	<tr>
		<td class="td_title_right_oth"><input type='checkbox' name='ids' value='<bean:write name="list" property="ROLE_ID"/>'/></td>
		<td class="td_title_right_oth"><bean:write name="list" property="ROLE_ID"/></td>
		<td class="td_title_right_oth"><bean:write name="list" property="USERNAME"/></td>
		<td class="td_title_right_oth">
		<logic:equal name="list" property="IS_USED" value="0">锁定</logic:equal>
		<logic:equal name="list" property="IS_USED" value="1">启用</logic:equal>
		</td>
		<td align="center" class="td_title_right_oth">
			<logic:equal name="user" property="IS_SUPER" value="1">
			<a href="<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=user_info&id=<bean:write name='list' property='ROLE_ID'/>" class="pn-opt">授权</a>
			 | <a href="<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=user_delete&ids=<bean:write name='list' property='ROLE_ID'/>" onclick="if(!confirm('您确定删除吗？')) {return false;}" class="pn-opt">删除</a>
			</logic:equal>
			<logic:equal name="user" property="IS_SUPER" value="0">
			<logic:equal name="user" property="ROLE_ID" value="4">
			<a href="<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=user_info&id=<bean:write name='list' property='ROLE_ID'/>" class="pn-opt">授权</a>
			</logic:equal>
			<logic:equal name="user" property="ROLE_ID" value="2">
			<a href="<%=Constants.PREFIX_PATH %>/UsersAction.do?opt=user_delete&ids=<bean:write name='list' property='ROLE_ID'/>" onclick="if(!confirm('您确定删除吗？')) {return false;}" class="pn-opt">删除</a>
			</logic:equal>		
			</logic:equal>	
		</td>
	</tr>
	</logic:iterate>
</table>
<div>
	<logic:equal name="user" property="IS_SUPER" value="0">
			<logic:equal name="user" property="ROLE_ID" value="2">
			<input type="button" value="删除" onclick="optDelete();"/>
			</logic:equal>		
	</logic:equal>
	<logic:equal name="user" property="IS_SUPER" value="1">
	<input type="button" value="删除" onclick="optDelete();"/>
	</logic:equal>
</div>
</form>
<%@ include file="../../common/alert_message.jsp" %>
</body>
</html>